<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@include file="/WEB-INF/public/head.jsp" %>


<%@include file="/WEB-INF/public/nav.jsp" %>
<style>
    .row .cf{
        margin-bottom: 10px;
    }
</style>

<div class="main-container" id="main-container">
    <script type="text/javascript">
        try{ace.settings.check('main-container' , 'fixed')}catch(e){}
    </script>

    <div class="main-container-inner">
        <a class="menu-toggler" id="menu-toggler" href="#">
            <span class="menu-text"></span>
        </a>


        <%@include file="/WEB-INF/public/menu.jsp" %>

        <div class="main-content">
            <%@include file="/WEB-INF/public/breadcrumb.jsp" %>

            <div class="page-content">
                <div class="row">
                    <div class="cf">
                        <a class="btn btn-info" href="${pageContext.request.contextPath}/setting/addConfig">新增</a>
                    </div>
                    <table class="table table-bordered table-striped">
                        <tr>
                            <td align="center">变量名称</td>
                            <td align="center">变量值</td>
                            <td align="center">变量描述信息</td>
                            <td align="center">操作</td>
                        </tr>

                        <c:forEach items="${settings}" var="a">
                            <tr>
                                <td align="center">${a.k}</td>
                                <td align="center">${a.v}</td>
                                <td align="center">${a.name}</td>
                                <td align="center"><a href="${pageContext.request.contextPath}/setting/editConfig?k=${a.k}" class="icon-edit">修改</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:;" onclick="del('${a.k}')" class="icon-remove">删除</a></td>
                            </tr>
                        </c:forEach>
                    </table>
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div><!-- /.main-content -->

    </div><!-- /.main-container-inner -->

    <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
        <i class="icon-double-angle-up icon-only bigger-110"></i>
    </a>
</div>
<!-- /.main-container -->
<%@include file="/WEB-INF/public/footerjs.jsp" %>
<script src="/ace/js/bootbox.min.js"></script>

<script>
    function del(k){
        $.post("/setting/delConfig",{k:k},function(data){
            if(data>0){
                bootbox.alert("删除成功");
                setTimeout(function(){
                    location.reload();
                },1000)
            }else{
                bootbox.alert("删除失败");
            }
        })
    }
</script>

<%@include file="/WEB-INF/public/foot.jsp" %>
